﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using BusinessObjects.BO_GetObjects;
using System.Web.UI.HtmlControls;
using LibraryO2S;

public partial class Controls_SettingGroups : Pages_Base
{

    protected void Page_Load(object sender, EventArgs e)
    {
        base.removeHGC(divMessage);
        if (!IsPostBack)
            loadSettingGroups();
    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
    }
    protected void loadSettingGroups()
    {
        try
        {
            //int c_id;
            //if (Request["c_id"] != null)
            //    c_id = Convert.ToInt32(Request["c_id"]);
            //else
            //    c_id = 0;
            //DataTable objDT = null;//BO_Categories.SelectParent(c_id, 1);
            DataTable objDT = BO_SettingGroups.SelectAll(1);
            base.bindRepeater(rptData, objDT, divMessage);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    protected void rptData_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try
        {
            if (e.CommandName.Equals("del"))
            {
                BO_SettingGroups.Delete(Convert.ToInt32(e.CommandArgument));
                divMessage.InnerHtml = O2S_Message.Success("Thông Báo", "Xóa thành công .");
            }
            loadSettingGroups();
        }
        catch (Exception ex)
        {
            divMessage.InnerHtml = O2S_Message.Error("Lỗi", "Phát hiện lỗi: <br />" + ex.Message);
        }
    }
    protected void btnNew_Click(object sender, EventArgs e) { Response.Redirect("default.aspx?module=settinggroupnew"); }
}